home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / CUGUK / C005.ZIP / AMORTIZ / MENU.C < prev    next >
Text File  |  1990-01-19  |  2KB  |  85 lines

  1. /********************************************************************
  2.  * C Users Group (U.K) C Source Code Library File CUGLIB.005        *
  3.  * Inquiries to: M. Houston, 36 Whetstone Clo. Farquhar Rd.         *
  4.  * Edgbaston, Birmingham B15 2QN ENGLAND                *
  5.  ********************************************************************
  6.  * File name: menu.c
  7.  * Program name: 
  8.  * Source of file: The Public Domain Software Library.
  9.  * Purpose: interest rate calculations.
  10.  * Changes: <who what when & why major changes have been made>      
  11.  ********************************************************************/
  12.  
  13. /*
  14. **        menu to print amortization
  15. **        selecting whether to compute payment or not.
  16. **
  17. **
  18. amount = starting balance
  19. balance = remaining balance
  20. rate = interest rate per period
  21. rate1 = interest rate per year
  22. payment = monthly payment
  23. principal = payment to principle
  24. interest = payment of interest per period
  25.  
  26. *******************************************************
  27. *        declare variables        */
  28.  
  29.     float amount = 0;
  30.     float balance = 0;
  31.     float rate1 = 0;
  32.     float rate = 0;
  33.     float payment = 0;
  34.     float principal = 0;
  35.     float interest = 0;
  36.  
  37.  
  38.  
  39. /*    **************************    */
  40. main()    /*    rename to menu()    */
  41.  
  42.     {
  43.     int answer;
  44.  
  45.     float pymt();
  46.     float interest1();
  47.  
  48.         scroll();        
  49.  
  50.         printf("Would you like me to figure the payment, Y or N ? ");
  51.  
  52.         answer = getchar();
  53.         answer = toupper(answer);
  54.         scroll();
  55.         if ((answer != 'Y') && (answer !='N') )
  56.             main();
  57.             
  58.             printf("What is the amount of the loan ? ");
  59.             scanf("%f",&amount);
  60.  
  61.             printf("What is the annual interest rate ? ");
  62.             scanf("%f",&rate1);
  63.             rate = (rate1 * .01)/12;
  64.  
  65.             if (answer == 'Y')
  66.             pymt(amount,rate);
  67.         else
  68.             {
  69.             printf("What is the monthly payment ? ");
  70.             scanf("%f",&payment);
  71.             }
  72.  
  73.     interest1(amount,rate,payment);
  74.  
  75.     }
  76.  
  77.  
  78.     scroll()
  79.         {
  80.         int screen = 0;
  81.                 while (++screen    <26)
  82.             printf("\n");
  83.         }
  84.  
  85.